<!DOCTYPE html>
<html lang="zh_CN" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head th:fragment="head">
	<base th:href="@{/}">
	<meta charset="utf-8">
	<title>新增</title>
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="format-detection" content="telephone=no">
	<link rel="stylesheet" href="static/layui/css/layui.css" media="all" />
	<link rel="stylesheet" type="text/css" href="static/jquery-easyui/themes/default/easyui.css">
	<link rel="stylesheet" type="text/css" href="static/jquery-easyui/themes/icon.css">
	<link rel="stylesheet" href="static/layui/css/layui.css" media="all" />
	<script type="text/javascript" src="static/layui/layui.js"></script>
	<script type="text/javascript" src="static/jquery-easyui/jquery.min.js"></script>
	<script type="text/javascript" src="static/jquery-easyui/jquery.easyui.min.js"></script>
	<script type="text/javascript" src="static/jquery-easyui/locale/easyui-lang-zh_CN.js"></script> 
</head>
<body class="layui-fluid" th:fragment="body">
	<div class="layui-row">
		<div class="layui-col-md12">
			<div class="layui-card-header">订单工序信息及计算来源</div>
			<div class="layui-row" style="margin-top: 5px;">
				<div class="layui-col-md12">
					<table id="orderTable" class="layui-table" lay-filter="orderTable"></table>
				</div>
			</div>
			<div class="layui-card-header">加工工序信息</div>
			<div class="layui-row" style="margin-top: 5px;">
				<div class="layui-col-md12">
					<table id="productTable" class="layui-table" lay-filter="productTable"></table>
				</div>
			</div>
		</div>
	</div>
	<script type="text/javascript" th:inline="javascript">
		layui.use(['layer','table','element','form'],function(){
			var layer = layui.layer,
				table = layui.table,
				form = layui.form,
				element = layui.element;
			load();
			function load(){
				$.post('manage/settlement_report/process_info', {detailId : [[${detailId}]]}, function (dd){
					table.render({
						elem:'#orderTable'
						,page: false //开启分页
						,loading: true
						,cols: [
							[ //表头
								{field: 'serialNumber', title: '工序序列号', minWidth:'100'}
								,{field: 'orderProcess', title: '订单工序编码', minWidth:'110'}
								,{field: 'orderProcessName', title: '订单工序名称', minWidth:'120'}
								// ,{field: 'settlementType', title: '结算单结算类型', minWidth:'100', templet: function (d){
								// 	return d.settlementType==null?'':(d.settlementType=='0'?'正常结算':'异常结算');
								// }}
								,{field: 'qty', title: '订单数量', minWidth:'90'}
								,{field: 'pricingMethod', title: '计价方式', minWidth:'90'}
								,{field: 'expectHours', title: '标准工时', minWidth:'90'}
								,{field: 'ioricost', title: '工序单价', minWidth:'90'}
								,{field: 'ioritaxamount', title: '订单工序金额', minWidth:'300', templet: function (d){
									return d.pricingMethod=='计时'?'标准工时*工序单价*订单数量='+(d.expectHours*d.ioricost*d.qty):'工序单价*订单数量='+(d.ioricost*d.qty)
								}}
								// ,{field: 'actHours', title: '实际工时', minWidth:'90'}
								// ,{field: 'settlementQty', title: '结算数量', minWidth:'90'}
								// ,{field: 'settlementcost', title: '结算单价', minWidth:'100'}
								// ,{field: 'settlementAmountInfo', title: '结算工序金额', minWidth:'350'}
							]
						]
						,text: {
							none: '暂无相关数据' //默认：无数据。注：该属性为 layui 2.2.5 开始新增
						}
						,data: dd.data
					});
				});
			}

			table.on('row(orderTable)', function(obj){
				obj.tr.addClass('layui-table-click').siblings().removeClass('layui-table-click');//选中行样式
				$.post('manage/settlement_report/product_process_info',{processId: obj.data.id},function (d){
					table.render({
						elem:'#productTable'
						,page: false //开启分页
						,loading: true
						,cols: [
							[ //表头
								{field: 'serialNumber', title: '工序序列号', minWidth:'100'}
								// ,{field: 'settlementType', title: '结算单结算类型', minWidth:'100', templet: function (d){
								// 	return d.settlementType==null?'':(d.settlementType=='0'?'正常结算':'异常结算');
								// }}
								,{field: 'productProcess', title: '加工工序编码', minWidth:'100'}
								,{field: 'productProcessName', title: '加工工序名称', minWidth:'120'}
								,{field: 'qty', title: '合格数量', minWidth:'90'}
								// ,{field: 'pricingMethod', title: '计价方式', minWidth:'90'}
								,{field: 'expectHours', title: '工序工时', minWidth:'90'}
								// ,{field: 'settlementQty', title: '结算数量', minWidth:'90'}
								// ,{field: 'settlementCost', title: '结算单价', minWidth:'100'}
								// ,{field: 'settlementAmount', title: '结算工序金额', minWidth:'350'}
							]
						]
						,text: {
							none: '暂无相关数据' //默认：无数据。注：该属性为 layui 2.2.5 开始新增
						}
						,data: d.data
					});
				})
			});
		})
	</script>
</body>
</html>